home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / rj.arc / NOVELL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-05  |  4.8 KB  |  242 lines

  1. /****************************************************************/
  2. /*                                */
  3. /* novell.c    06/19/86                    */
  4. /*                                */
  5. /* this is a collection of Novell Network System calls        */
  6. /*                                */
  7. /****************************************************************/
  8.  
  9. #include <dos.h>
  10. union REGS inregs, outregs;
  11. struct SREGS segregs;
  12.  
  13. static char request[128], response[128];
  14.  
  15. seteoj(flag)
  16. int flag;
  17. {
  18.     inregs.h.ah = 0xbb;
  19.     inregs.h.al = flag;
  20.     intdos(&inregs, &outregs);
  21.     return(0);
  22. }
  23.  
  24. getusr()
  25. {
  26.     inregs.h.ah = 0xdc;
  27.     intdos(&inregs, &outregs);
  28.     return(outregs.h.al);
  29. }
  30.  
  31. brdcast(num_stations, station_list, message)
  32. int num_stations;
  33. char *station_list;
  34. char *message;
  35. {
  36.     int i;
  37.     
  38.     request[2] = 0;
  39.     request[3] = num_stations;
  40.     for (i=0; i<num_stations; i++) {
  41.         request[i+4] = *(station_list+i);
  42.     }
  43.     for (i=0; *(message+i) != '\0'; i++) {
  44.         request[num_stations + 5 + i] = message[i];
  45.     }
  46.     request[num_stations + 4] = i;
  47.     request[0] = 3 + num_stations + i;
  48.  
  49.     inregs.h.ah = 0xe1;
  50.     segread(&segregs);
  51.     inregs.x.si = (unsigned) (request);
  52.     inregs.x.di = (unsigned) (response);
  53.     intdosx(&inregs, &outregs, &segregs);
  54.  
  55.     for (i=0; i<num_stations; i++) {
  56.         station_list[i] = response[i+3];
  57.     }
  58.     return(0);
  59. }
  60.  
  61. pipopen(num_stations, station_list)
  62. int num_stations;
  63. char *station_list;
  64. {
  65.     int i;
  66.     
  67.     for (i=0; i<num_stations; i++) {
  68.         request[i+4] = *(station_list+i);
  69.     }
  70.     request[0] = 2 + num_stations;
  71.     request[2] = 6;
  72.     request[3] = num_stations;
  73.  
  74.     response[0] = 1 + num_stations;
  75.  
  76.     inregs.h.ah = 0xe1;
  77.     segread(&segregs);
  78.     inregs.x.si = (unsigned) (request);
  79.     inregs.x.di = (unsigned) (response);
  80.     intdosx(&inregs, &outregs, &segregs);
  81.  
  82.     for (i=0; i<num_stations; i++) {
  83.         station_list[i] = response[i+3];
  84.     }
  85.     return(0);
  86. }
  87.  
  88. pipclose(num_stations, station_list)
  89. int num_stations;
  90. char *station_list;
  91. {
  92.     int i;
  93.     
  94.     for (i=0; i<num_stations; i++) {
  95.         request[i+4] = *(station_list+i);
  96.     }
  97.     request[0] = 2 + num_stations;
  98.     request[2] = 7;
  99.     request[3] = num_stations;
  100.  
  101.     response[0] = 1 + num_stations;
  102.  
  103.     inregs.h.ah = 0xe1;
  104.     segread(&segregs);
  105.     inregs.x.si = (unsigned) (request);
  106.     inregs.x.di = (unsigned) (response);
  107.     intdosx(&inregs, &outregs, &segregs);
  108.  
  109.     for (i=0; i<num_stations; i++) {
  110.         station_list[i] = response[i+3];
  111.     }
  112.     return(0);
  113. }
  114.  
  115. pipread(message)
  116. char *message;
  117. {
  118.     int i, j;
  119.     
  120.     request[0] = 1;
  121.     request[2] = 5;
  122.  
  123.     response[0] = 126;
  124.  
  125.     inregs.h.ah = 0xe1;
  126.     segread(&segregs);
  127.     inregs.x.si = (unsigned) (request);
  128.     inregs.x.di = (unsigned) (response);
  129.     intdosx(&inregs, &outregs, &segregs);
  130.  
  131.     j = (int) response[0];
  132.     for (i=0; i<j; i++) {
  133.         message[i] = response[i+2];
  134.     }
  135.     return(0);
  136. }
  137.  
  138. pipwrite(num_stations, station_list, message)
  139. int num_stations;
  140. char *station_list;
  141. char *message;
  142. {
  143.     int i;
  144.  
  145.     request[2] = 4;
  146.     request[3] = num_stations;
  147.     for (i=0; i<num_stations; i++) {
  148.         request[i+4] = *(station_list+i);
  149.     }
  150.     for (i=0; *(message+i) != '\0'; i++) {
  151.         request[num_stations + 5 + i] = message[i];
  152.     }
  153.     request[num_stations + 4] = i;
  154.     request[0] = 3 + num_stations + i;
  155.  
  156.     inregs.h.ah = 0xe1;
  157.     segread(&segregs);
  158.     inregs.x.si = (unsigned) (request);
  159.     inregs.x.di = (unsigned) (response);
  160.     intdosx(&inregs, &outregs, &segregs);
  161.  
  162.     for (i=0; i<num_stations; i++) {
  163.         station_list[i] = response[i+3];
  164.     }
  165.     return(0);
  166. }
  167.  
  168. semopen(name, value, handle, users)
  169. char *name;
  170. int value;
  171. unsigned long *handle;
  172. int *users;
  173. {
  174.     int i;
  175.     
  176.     for (i=0; *(name+i) != '\0'; i++) {
  177.         request[i+1] = *(name+i);
  178.     }
  179.     request[0] = i;
  180.  
  181.     inregs.h.ah = 0xc5;
  182.     inregs.h.al = 0x00;
  183.     inregs.h.cl = value;
  184.     inregs.x.dx = (unsigned) (request);
  185.     intdos(&inregs, &outregs);
  186.     *handle = ((long) outregs.x.dx << 16) + outregs.x.cx;
  187.     *users = outregs.h.bl;
  188.     return(outregs.h.al);
  189. }
  190.  
  191. semexam(handle, value, users)
  192. unsigned long handle;
  193. int *value;
  194. int *users;
  195. {
  196.     inregs.h.ah = 0xc5;
  197.     inregs.h.al = 0x01;
  198.     inregs.x.cx = handle & 0xffff;
  199.     inregs.x.dx = handle >> 16;
  200.     intdos(&inregs, &outregs);
  201.     *value = outregs.x.cx;
  202.     *users = outregs.h.dl;
  203.     return(outregs.h.al);
  204. }
  205.  
  206. semwait(handle, timout)
  207. unsigned long handle;
  208. int timout;
  209. {
  210.     inregs.h.ah = 0xc5;
  211.     inregs.h.al = 0x02;
  212.     inregs.x.cx = handle & 0xffff;
  213.     inregs.x.dx = handle >> 16;
  214. /*
  215.     inregs.x.bp = timout;
  216. */
  217.     intdos(&inregs, &outregs);
  218.     return(outregs.h.al);
  219. }
  220.  
  221. semsig(handle)
  222. unsigned long handle;
  223. {
  224.     inregs.h.ah = 0xc5;
  225.     inregs.h.al = 0x03;
  226.     inregs.x.cx = handle & 0xffff;
  227.     inregs.x.dx = handle >> 16;
  228.     intdos(&inregs, &outregs);
  229.     return(outregs.h.al);
  230. }
  231.  
  232. semclose(handle)
  233. unsigned long handle;
  234. {
  235.     inregs.h.ah = 0xc5;
  236.     inregs.h.al = 0x04;
  237.     inregs.x.cx = handle & 0xffff;
  238.     inregs.x.dx = handle >> 16;
  239.     intdos(&inregs, &outregs);
  240.     return(outregs.h.al);
  241. }
  242.